nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

NestJS/Authentication and Authorization

Make sure users are who they claim to be and control exactly what each user is allowed to access.

20 QuestionsAdvancedHigh Priority ~15 min read

Authentication answers the question "Who are you?", while authorization answers "What are you allowed to do?". A NestJS application often combines authentication strategies, tokens or sessions, guards, and user roles or permissions to protect its APIs.

A common flow is to authenticate a user, attach their identity to the request, and then use guards to decide whether that user can access a specific resource. Good security also requires careful handling of passwords, tokens, sessions, permissions, and sensitive data.

What you'll walk away knowing

The difference between authentication and authorization
How authentication strategies and tokens fit together
How guards protect routes and enforce permissions
How role-based and permission-based access control works
1How do you register a global JWT guard so all routes are protected by default in NestJS?Intermediate2How do you implement a local (username/password) Passport strategy in NestJS?Intermediate3How do you implement API key authentication as an alternative to JWT in NestJS?Intermediate4How do you implement JWT authentication in NestJS with access and refresh tokens?Intermediate5What is the difference between AuthGuard('jwt') from Passport and writing a custom JwtAuthGuard in NestJS?Intermediate6What is RBAC and how do you implement a basic roles guard in NestJS?Intermediate7How do you implement JWT token revocation (blacklisting) without a database lookup on every request in NestJS?Advanced8How do you implement brute force protection on the login endpoint in NestJS?Intermediate9What is PKCE and when is it required in OAuth2 flows in NestJS?Intermediate10What is Passport.js and how does it integrate with NestJS?Intermediate11How do you implement session-based authentication in NestJS?Intermediate12How do you implement two-factor authentication (2FA) with TOTP in NestJS?Intermediate13How do you secure session cookies against common attacks (CSRF, XSS, session fixation) in NestJS?Intermediate14What is the difference between RBAC and ABAC and when would you use each in NestJS?Intermediate15How do you implement row-level (resource-level) authorization to ensure users can only access their own records in NestJS?Intermediate16How does the validate() method in a Passport strategy relate to the NestJS request lifecycle?Intermediate17How do you test authentication guards and strategies in NestJS?Intermediate18How do you implement JWT refresh token rotation with secure storage in NestJS?Advanced19What is the difference between JWT and session-based authentication and when do you choose each in NestJS?Intermediate20How do you implement ABAC with CASL in a NestJS application?Advanced21How do you implement permission-based authorization at the field level in a GraphQL resolver in NestJS?Intermediate22How does the OAuth2 authorization code flow work and how do you implement it with Passport in NestJS?Intermediate23How do you implement an OAuth2 Authorization Server in NestJS?Advanced24What should and should not go inside a JWT payload?Intermediate25How do you implement multi-tenant authentication where each tenant has its own JWT secret in NestJS?Advanced
All Topics
1
Basics
Modules
Controllers
Dependency Injection
Providers
2
Request Lifecycle
Middleware
Guards
Interceptors
Pipes
Filters
Exception Handling
3
Decorators
Architecture
API Design
4
GraphQL
Database and ORM
Microservices
5
Authentication and Authorization
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.